stylecontext: Deprecate regions
authorBenjamin Otte <otte@redhat.com>
Thu, 19 Jun 2014 18:00:16 +0000 (20:00 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 19 Jun 2014 20:26:51 +0000 (22:26 +0200)
Regions are done in a very non-css way. They don't fit the DOM in that
they don't integrate into the CSS tree and they have very weird matching
behavior in selectors.

So I'm deprecating them now. GtkNotebook and GtkTreeview will continue
to use them and as long as they do, we can't remove the code for it.
But once those are ported it might be safe to remove the code as it will
clean up lots of places in the code by quite a bit.

gtk/gtknotebook.c
gtk/gtkstylecontext.c
gtk/gtkstylecontext.h
gtk/gtkthemingengine.c
gtk/gtkthemingengine.h
gtk/gtktreeview.c

index 4cc472c317a83780686b96c2108c9502f5080ac1..73616715f9b94f016938964f9204879646fb278d 100644 (file)
@@ -2035,7 +2035,9 @@ notebook_tab_prepare_style_context (GtkNotebook *notebook,
   if (use_flags && (page != NULL))
     flags = _gtk_notebook_get_tab_flags (notebook, page);
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   gtk_style_context_add_region (context, GTK_STYLE_REGION_TAB, flags);
+G_GNUC_END_IGNORE_DEPRECATIONS
   add_tab_position_style_class (context, tab_pos);
 
   return state;
index 80c176ea12bea9279b4d1c20b1817ab12c33b1bf..45fcb9c1b1b4381ef8d912ffd3e6206887def2a8 100644 (file)
  * #GtkSettings:gtk-theme-name setting or a hierarchy change in the rendered
  * widget.
  *
- * # Style Classes and Regions # {#gtkstylecontext-classes}
+ * # Style Classes # {#gtkstylecontext-classes}
  *
  * Widgets can add style classes to their context, which can be used
  * to associate different styles by class
  * (see [Selectors][gtkcssprovider-selectors]).
  * Theme engines can also use style classes to vary their rendering.
  *
- * Widgets can also add regions with flags to their context.
+ * # Style Regions
+ *
+ * Widgets can also add regions with flags to their context. This feature is
+ * deprecated and will be removed in a future GTK+ update. Please use style
+ * classes instead.
  *
  * The regions used by GTK+ widgets are:
  *
@@ -1823,6 +1827,8 @@ gtk_style_context_list_classes (GtkStyleContext *context)
  *          itself with g_list_free() when you are done with it.
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.14
  **/
 GList *
 gtk_style_context_list_regions (GtkStyleContext *context)
@@ -1902,6 +1908,8 @@ _gtk_style_context_check_region_name (const gchar *str)
  * and “-”, starting always with a lowercase letter.
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.14
  **/
 void
 gtk_style_context_add_region (GtkStyleContext *context,
@@ -1943,6 +1951,8 @@ gtk_style_context_add_region (GtkStyleContext *context,
  * Removes a region from @context.
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.14
  **/
 void
 gtk_style_context_remove_region (GtkStyleContext *context,
@@ -1986,6 +1996,8 @@ gtk_style_context_remove_region (GtkStyleContext *context,
  * Returns: %TRUE if region is defined
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.14
  **/
 gboolean
 gtk_style_context_has_region (GtkStyleContext *context,
index 4967d45f473cce189622be3a2eac5fa2a10e9bf2..22182b36d7a84a1958da67d53ec7a0406d61c1c0 100644 (file)
@@ -939,17 +939,17 @@ GDK_AVAILABLE_IN_ALL
 gboolean gtk_style_context_has_class    (GtkStyleContext *context,
                                          const gchar     *class_name);
 
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_14
 GList *  gtk_style_context_list_regions (GtkStyleContext *context);
 
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_14
 void     gtk_style_context_add_region    (GtkStyleContext    *context,
                                           const gchar        *region_name,
                                           GtkRegionFlags      flags);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_14
 void     gtk_style_context_remove_region (GtkStyleContext    *context,
                                           const gchar        *region_name);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_14
 gboolean gtk_style_context_has_region    (GtkStyleContext    *context,
                                           const gchar        *region_name,
                                           GtkRegionFlags     *flags_return);
index 4cc9832eb6cdd97b016025ef137e99acfd36cfbe..402634df4c4738b58afca68ad875783abc6a49fd 100644 (file)
@@ -648,6 +648,8 @@ gtk_theming_engine_has_class (GtkThemingEngine *engine,
  * Returns: %TRUE if region is defined
  *
  * Since: 3.0
+ *
+ * Deprecated: 3.14
  **/
 gboolean
 gtk_theming_engine_has_region (GtkThemingEngine *engine,
@@ -662,7 +664,9 @@ gtk_theming_engine_has_region (GtkThemingEngine *engine,
   g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), FALSE);
 
   priv = engine->priv;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   return gtk_style_context_has_region (priv->context, style_region, flags);
+G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
 /**
index a60677497d596594acd1fb9ec12ba33683aeec18..7e75b1bc44cc5ba96bbf6779f99ce70079bdcc9d 100644 (file)
@@ -232,7 +232,7 @@ const GtkWidgetPath * gtk_theming_engine_get_path (GtkThemingEngine *engine);
 GDK_AVAILABLE_IN_ALL
 gboolean gtk_theming_engine_has_class  (GtkThemingEngine *engine,
                                         const gchar      *style_class);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_14
 gboolean gtk_theming_engine_has_region (GtkThemingEngine *engine,
                                         const gchar      *style_region,
                                         GtkRegionFlags   *flags);
index 825279ffe458c863513a237f103518a6445ccc89..83537c9d34ef992c5c2740369264297ffc6deccb 100644 (file)
@@ -5188,8 +5188,10 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
           gtk_style_context_set_state (context, state);
 
           gtk_style_context_add_class (context, GTK_STYLE_CLASS_CELL);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
           gtk_style_context_add_region (context, GTK_STYLE_REGION_ROW, row_flags);
           gtk_style_context_add_region (context, GTK_STYLE_REGION_COLUMN, column_flags);
+G_GNUC_END_IGNORE_DEPRECATIONS
 
          if (node == tree_view->priv->cursor_node && has_can_focus_cell
               && ((column == tree_view->priv->focus_column
@@ -14574,7 +14576,9 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView  *tree_view,
   context = gtk_widget_get_style_context (widget);
 
   gtk_style_context_save (context);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   gtk_style_context_add_region (context, GTK_STYLE_REGION_COLUMN, 0);
+G_GNUC_END_IGNORE_DEPRECATIONS
 
   gtk_widget_style_get (widget,
                        "allow-rules", &allow_rules,
@@ -14589,7 +14593,9 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView  *tree_view,
       else
         row_flags = GTK_REGION_EVEN;
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
       gtk_style_context_add_region (context, GTK_STYLE_REGION_ROW, row_flags);
+G_GNUC_END_IGNORE_DEPRECATIONS
     }
 
   is_separator = row_is_separator (tree_view, &iter, NULL);